package C;

import java.util.Scanner;

public class C42 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.nextLine();
        int n = num.length();
        int sum = 0;
        System.out.println(Math.pow(9,2));
        for (int i=0;i<n;i++) {
            int x = Integer.parseInt(String.valueOf(num.charAt(i)));
            if (x>4) x--;
            sum += Math.pow(9,n-i-1)*x;
            System.out.println("sum="+sum);
        }

    }
}
